<?php
/**
 * Created by PhpStorm.
 * User: 共赢岛
 * Date: 2023/12/21
 * Time: 14:48
 */

namespace App\Http\Controllers\API;

use App\Http\Controllers\Controller;
use Qiniu\Auth;

class UploadController extends  Controller
{
    public function token()
    {
        $config = config('filesystems.disks.qiniu');
        // 构建鉴权对象
        $auth = new Auth($config['access_key'], $config['secret_key']);
        // 要上传的空间
        $bucket = $config['bucket'];
        // 生成上传 Token
        $token = $auth->uploadToken($bucket);

        return $this->success($token);
    }
}